<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/common/session.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
    <HEAD>
        <TITLE>红魔方</TITLE>
        <link rel="stylesheet" type="text/css" href="${ctx}/css/default.css">
        <link rel="stylesheet" type="text/css" href="${ctx}/css/menu.css">
        <link rel="stylesheet" type="text/css" href="${ctx}/css/ext-all.css"/>
        <link rel="stylesheet" type="text/css" href="${ctx}/css/cbpFWTabs.css">
        <style type="text/css">
            .westIcon {
                background-image:url(../images/ext/tabs/nav1.gif);
            }
            .tab {
                background-image:url(../images/ext/tabs/tabs.gif);
            }
        </style>
        <script type="text/javascript" src="https://echarts.baidu.com/build/dist/echarts-all.js"></script>
        <script type="text/javascript" src="${ctx}/js/menu.js"></script>
        <script type="text/javascript" src="${ctx}/js/ext-base.js"></script>
        <script type="text/javascript" src="${ctx}/js/ext-all.js"></script>
        <script type="text/javascript" src="${ctx}/dwr/engine.js"></script>
        <script type="text/javascript" src="${ctx}/dwr/util.js"></script>
        <script type="text/javascript" src="${ctx}/js/loading.js"></script>
        <script type="text/javascript" src="${ctx}/dwr/interface/OrderService.js"></script>
        <script type="text/javascript" src="${ctx}/dwr/interface/EnquiryService.js"></script>
        <script type='text/javascript' src='${ctx}/dwr/interface/RevaluateOrderService.js'></script>
        <script type="text/javascript">
            var tabPanelCenter = new Ext.TabPanel({
                region:'center',
                deferredRender:false,
                enableTabScroll:true,
                activeTab:0,
                margins:'0 0 0 0',
                iconCls: 'tab',
                items:[{
                    id:'home',
                    contentEl:'centerDiv',
                    title: '工作台',
                    closable:false,
                    autoScroll:true
                }]
            });

            Ext.onReady(function(){
                var viewport = new Ext.Viewport({
                    layout:'border',
                    maximizable: true,
                    items:[
                        {
                            region:'north',
                            title:' ',
                            contentEl: 'northDiv',
                            height: 90,
                            collapsible: true,
                            split:true,
                            margins:'5 5 0 5'
                        },
                        {
                            region:'south',
                            contentEl: 'southDiv',
                            height: 0,
                            collapsible: false,
                            split:true,
                            margins:'0 5 0 5'
                        },
                        {
                            region:'west',
                            title:' ',
                            width: 200,
                            collapsible: true,
                            split:true,
                            margins:'0 0 0 5',
                            layout:'accordion',
                            iconCls:'westIcon',
                            contentEl:'westDiv'
                        },
                        {
                            region:'east',
                            title:' ',
                            width: 200,
                            collapsible: true,
                            split:true,
                            margins:'0 5 0 0',
                            layout:'accordion',
                            iconCls:'eastIcon',
                            contentEl:'eastDiv'
                        },
                        tabPanelCenter
                    ]
                });
            });

            function addTab(uuid, tabTitle, targetUrl){
                targetUrl = encodeURIComponent(targetUrl);
                closeTab(uuid);
                tabPanelCenter.add({
                    id:uuid,
                    title: tabTitle,
                    iconCls: 'tab',
                    autoLoad: {url: "${ctx}/home/forward.jsp?url=" + targetUrl, callback: this.initSearch, scope: this},
                    closable:true
                }).show();
            }

            function showMenuItem(uuid, tabTitle, targetUrl) {
                var tab = tabPanelCenter.getItem(uuid);
                if(tab){
                    tabPanelCenter.setActiveTab(tab);
                } else{
                    tab = addTab(uuid, tabTitle, targetUrl);
                }
            }

            function closeTab(uuid){
                var tab = tabPanelCenter.getItem(uuid);
                if (tab) {
                    tabPanelCenter.remove(tab);
                }
            }

            function closeAllTab(){
                if(confirm("确定关闭所有页签")){
                    //循环遍历
                    tabPanelCenter.items.each(
                        function(item){
                            if(item.closable){
                                //可以关闭的其他所有标签页全部关掉
                                tabPanelCenter.remove(item);
                            }
                        }
                    );
                }
            }
            function resetHomeFrameHeight(height) {
                document.getElementById("centerFrame").height = height;
            }
            function forwardEastFrame(url) {
                document.getElementById("eastFrame").src = url;
            }
            <%String token = response.getHeader("Authorization");%>
            sessionStorage.setItem("Authorization", "<%=token%>");
        </script>
    </HEAD>
    <body style="background-color:#f0f7ff;">
    <div id="northDiv" align="center">
        <%@include file="logo.jsp"%>
    </div>
    <div id="southDiv" align="center">
        <br/>
        <span style="color:#4682B4;">  </span>
    </div>
    <div id="westDiv" style="height:100%">
        <iframe id="westFrame" name="westFrame" src="${ctx}/home/accordion.jsp" width="100%" height="100%" frameborder="0">
        </iframe>
    </div>
    <div id="eastDiv" style="height:100%">
        <iframe id="eastFrame" name="eastFrame" src="" width="100%" height="100%" frameborder="0">
        </iframe>
    </div>
    <div id="centerDiv" style="height:100%">
        <%@include file="/bpm/order_count_user_state_list.jsp"%>
    </div>
    </body>
</html>
